import { Toast  } from "vant";
import cTitle from "components/title";
import { scrollMixin } from "../../../utils/mixin";
export default {
    mixins: [scrollMixin], //加载更多
  data() {
    return {
        items: [],
        uid: '',
        total_page:1,
        page:1,
        isLoadMore: true,
    };
  },

  components: {
    cTitle
  },
  activated() {
    console.log(this.$route.params,'直推用户')
    this.uid = this.$route.params.uid;
    this.getData();
  },
  computed: {
   
  },
  methods: {
    
    getData(){
        $http.get("ZhengChengYc.zhitui_list", {
            uid: this.uid,
            page: this.page,
          }, "加载中").then((res) => {
            if (res.result == 1) {
              console.log(res,'zhitui_list')
            //   this.items = res.data;
              this.total_page = res.data.last_page;
              var nextPageData = res.data.data;
              this.items = [...this.items, ...nextPageData];
              this.isLoadMore = true;
            }
          });
    },
     //获取更多数据
     getMoreData() {
        console.log("伙伴详情", this.isLoadMore);
        if (!this.isLoadMore) return;
        this.isLoadMore = false; // 防止多次请求分页数据
        if (this.page >= this.total_page) {
            Toast('到底了')
          return;
        } else {
          this.page += 1;
          this.getData();
        }
      },
    
  }
};